/************************* 版本声明 *********************************
 *@since jdk1.5
 *@version 0.1
 ************************* 类描述 ***********************************
 *街拍前台页面控制器
 *
 ************************* 变更记录 *********************************
 *
 * 创建者：bijiqiang Email:bijiqiang@gmail.com   创建日期： 2010-10-27
 * 创建记录：创建类结构。
 * ……
 ************************* To  Do *********************************
 */
package com.realgodo.site.web;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springside.modules.orm.Page;

import com.realgodo.site.entity.site.Candid;
import com.realgodo.site.service.site.CandidManager;

@Scope("prototype")
public class CandidController extends ControllerSupport {

	private static final long serialVersionUID = 1705477381716296164L;

	@Resource
	private CandidManager candidManager;

	private Page<Candid> candidPage = new Page<Candid>(20);

	private Candid candid;

	private Long id;

	public String index() {
		candidPage.setPageNo(candidManager.isParamNotNull(getParamMap(),
				Page.PAGE) ? Integer.valueOf((String) candidManager
				.getParamValue(getParamMap(), Page.PAGE)) : 1);// 查询页数
		candidPage = this.candidManager.findCandids(candidPage);
		super.setPageInfo(candidPage);
		return "candid";
	}

	public String show() {
		candid = (getId() != null) ? this.candidManager.get(getId()) : null;
		return "show";
	}

	/******************* getter and setter *************************/
	public Page<Candid> getCandidPage() {
		return candidPage;
	}

	public void setCandidPage(Page<Candid> candidPage) {
		this.candidPage = candidPage;
	}

	public Candid getCandid() {
		return candid;
	}

	public void setCandid(Candid candid) {
		this.candid = candid;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

}
